package com.example.mapper;

import com.example.pojo.Dept;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper//会将查询结果映射到java对象中
public interface DeptMapper {
    //查询全部部门数据
    @Select("select * from dept")
    List<Dept> list();//调用list方法时会执行上面的sql语句
    @Delete("delete from dept where id=#{id}")
    void listDelete(Integer id);

    @Insert("insert into dept(name,create_time,update_time) values (#{name},#{createTime},#{updateTime})")
    void insert(Dept dept);
    @Select("select*from dept where id=#{id}")
    List<Dept> selectById(Integer id);
    @Update("update dept set name=#{name} where id=#{id}")
    void update(Dept dept);
}
